/**
 *	 charset for data
 *   VisualGroup JavaScript prototype Classes, version draf
 *  (c) 2006 Bill Vison <vison_ruan@126.com>
 *
 *
/*--------------------------------------------------------------------------*/

// include javascript src , check the file first and will include file 
includeJavascriptSrc = function($javascriptFile) {
	var src = "<scr"+"ipt language=\"javascript\" src=\"";
	src +=$javascriptFile;
	src +="\"></scr"+"ipt>";
	document.writeln(src);
}

getRootScriptContent = function() {
	var $current = window.location.href;
	var $i = $current.indexOf("modules");
	// --- the html file in modules
	if ($current.indexOf("modules") > 0 || $current.indexOf("components") > 0) {
		return "../..";
	} else {
		return ".";
	}
}

/**
 * defined the global object or mathod
	openProxyWindow('un-grid-win', {
		title         : '弹出新窗口',
    	width         : 400,
    	height        : 350,
    	maximizable   : true,
    	collapsible   : true,
    	constrain     : true,
    	shadow        : Ext.isIE,
    	animCollapse  : false,
    	autoScroll    : true,
    	hideMode      : 'nosize',
    	defaultSrc    : "http://www.google.com",
    	loadMask  :  {msg:\'Loading \' + \"http://localhost/\"}
	} , Ext.ux.ManagedIFrame.Window);
*/
openProxyWindow = function(windowId , option , windowClass) {


	var proxyObj = parent.UserDesktop;

	if (proxyObj) {
	
		proxyObj.openProxyWindow(windowId, option , windowClass);
	}

}



/**
 * load some base js
 */
function loadBaseJs() {
	
	var $content = getRootScriptContent();
	
	includeJavascriptSrc($content+"/js/lib/adapter/ext/ext-base-debug.js");
	includeJavascriptSrc($content+"/js/lib/ext-all-debug.js");
	includeJavascriptSrc($content+"/js/lib/debug.js");
	includeJavascriptSrc($content+"/js/Interface.js");
	includeJavascriptSrc($content+"/js/Exception.js");
	// --- set vs engine implement handle ---
	includeJavascriptSrc($content+"/js/FlashVsEngine.js");
	
	includeJavascriptSrc($content+"/js/run.js");	

	// extend libs
	includeJavascriptSrc($content+"/js/lib/ext_config.js");
	includeJavascriptSrc($content+"/js/lib/ux/RowExpander.js");
	includeJavascriptSrc($content+"/js/lib/ux/Portal.js");
	includeJavascriptSrc($content+"/js/lib/ux/PortalColumn.js");
	includeJavascriptSrc($content+"/js/lib/ux/Portlet.js");
	includeJavascriptSrc($content+"/js/lib/ext-lang-zh_CN.js");
	
	// --- extend load class ---
	includeJavascriptSrc($content+"/js/Vsg/FlashHttpRequest.js");


	
}
/**
 * running the main programe for the js
 */
(function() {
	loadBaseJs();
	// add the new plugin
	/*
	if (loadPluginJs != null) {
		loadPluginJs();
	}
	*/
	
})();



